package com.zzty.txj1.dao;

import com.zzty.txj1.entity.UserEvents;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserEventsDao {
    @Select("select * from userevents where id=#{id}")
    UserEvents getUserEventsById(UserEvents userEvents);

    @Select("select * from userevents where userId=#{userId}")
    UserEvents getUserEventsByUserId(UserEvents userEvents);

    @Update("update userevents  set eventId=#{eventId} where userId=#{userId} ;")
    Integer updateUserEvents(UserEvents userEvents);

    @Update("insert into userevents  (userId,eventId) values(#{userId},#{eventId});")
    Integer addUserEvents(UserEvents userEvents);

    @Select("select * from userevents")
    List<UserEvents> getAllUserEvents();

    @Update("update userevents set eventId=#{eventId} where id=#{id}")
    Integer updateUserEventsById(UserEvents userEvents);

    @Delete("delete from userevents where id=#{id}")
    Integer deleteUsereventsById(UserEvents userEvents);

    @Select("select userId from userevents")
    List<Integer> getAllUserId();

}
